refactoring helper to use method and not yield