Complete refactor of all the plugin into a more OO design preparing for ...

...unit tests.