Adjusted code to new cPlugin