Moved to plugin to a class

Moved the plugin to object oriented php code and moved it to a class.