refactoring with interfaces