cleaned up server file and externalized sockets.js