refactoring with new design