Make Sublime plugin work with Sublime Text 2.

Fix misc threading issues in the plugin.