Refactored socket shit