Optimised plugin architecture

Hi, 

I was really impressed with your plugin concept and I wanted to contribute to you project. I have reorganised the architecture and optimised some of the methods. 

I also included an MIT license so that you would get proper recognition for your work.

I hope you like the changes.