refactored class names and outsourced sockets