Python3 support and code refactoring

I've started adding support for Python 3. This pull request addresses #8 and cherry-picks two commits from #13. It would be nice to enable Travis-Cl for this repository. Thanks

**NOTE** that this is work-in-progress. I'm looking for code review and help.