Code cleanup, integration socket server - client