Refactored plugin for new structure