refactoring: major refactoring of server.js