improved refactoring of commonly-used scripts.