Made some changes to get sockets to work right