generic OOP refactoring