Refactored for new plugin structure