Made changes to how the socket connection is setup