Reffactored plugin