Implemented suggested changes from jlec to socksipy