Refactors socket events, and code
Removes files which are not needed