Changed socket connection to be more callback-y