Refactored app initializer