Refactoring all functions to comply with the Object Oriented Programming