Remove redundant/useless code and make socket.io injectable