major refactor to cator for four independent sockets and improve DRYness