Renamed sockets to match C example and formatted code