Refactoring plugin.

Refactoring all files for more simple manage for the future features. A
special thanks goes to @justintadlock for inspiration to the structure
of the plugin.