refactor server startup workflow