Refactored code to meet a generic plugin

Changed file structure to suit generic plugin.