Using inheritance while refactoring