refactors server.js