Refactored socket and some client ideas