refactoring and simplifying methods