refactoring server initialization