improved the runScript script