updated for python 3 compatibility, and cleaned some things up