Fixed up some logic so that all of the socket connections are working