Fixed socket reference, changed to variable instead of function