Python 3 support for Sublime Text 3 compatibility

I used 2to3 and tweaked some functions. Nothing huge.