Corrected plugin code