refactored startup script