Refactored networking into the State Pattern. Each state has functions that are called on socket events. Changing the state changes which functions will be called.