Some minor refactoring
Rename obsolete unload_handler() to new plugin_unloaded()

Don't worry, this is compatible with ST2.
Optimize imports