refactoring and redesign