modified findnearest nodes