Refactored plugin