Changed the way that plugin instance is transfered from using function
calls to including it in the constructor.