Convert module from procedural to OOP style