Sublime Text 3 fixes

I got quite a lot of errors when trying to run the plugin in Sublime Text 3, so I decided to make it work.
Most errors were to do with the API changes between 2 and 3, but there were a couple of Python 2 and 3 differences too, for example, the print statement.

I have tested as much as I can in both Sublime Text 2 and 3, but I only have Windows to test on, so I hope the changes are ok on other platforms too.

__Tested on__
Windows 7 64-bit
Sublime Text 3 build 3030
Sublime Text 2 build 2219