Quick and rough first pass at moving the plugin into a class based structure.