Adding authorization middleware and cleaning up server.js