refactored plugin