Refactored code. Socket Server now keeps track of all connections.