Various python 3.x compatibility fixes.
Merge pull request #6 from concordusapps/python3

Various cleanup and compatibility fixes for python 3k.