refactoring to use another design