refactoring and added design