refactored startup