refactored 2 methods