refactoring and cleaning