moved handlers out from server.js