refactoring extract helper method