refactoring (using inheritance)