Refactoring GetForEachRef