Added comments and streamlined the plugin system