refactoring and improving