Refactoring application startup