Refactored function inline replacement
Refactoring using OOP