Performed some refactoring and converted to a plugin with a single task. Tests added for plugin.