extract same logic into FindNodes method