socket refactor
fixes