Refactoring existing code to take advantage of object-oriented programming