Put script environment creation/deletion in functions.