improve script compartmentalization