Refactored to work with newest express and socket.io versions