Converting plugin to object oriented code instead of procedural