refactor ,decoupled sockets, cleaned up logs