Remove unused code
Cleanup of unused code + logging
Better handling of client disconnect