Initial work on Python 3 compatibility