Python 3 compliance as well as remaining Python 2 compliant

A few changes that make the code run with Python 3.3.4 as well as 2.7.6.