Cleanup server.js and add more comments