Refactoring and simplifying