Some optimizations.
Merge pull request #6 from movingpictures83/plugin_refactor

Some optimizations.