Optimize find all refs