Socko implementation refactored a bit