Added BASEDIR to scripts to allow running them from an arbitrary directory