Improved code quality

Need to fix socket.io though