refactor server in its own module