refactoring startupscript