You might want to consider converting the sub-scripts to UDFs that are getting CALLed as this will make it easier to pass parameters. You might also want to take a look at the DB...() UDFs, which offer a couple of canned database functions.
_________________________
There are two types of vessels, submarines and targets.