Improve script flexibility