Refactored Server.js.