Added scriptdir global variable