add flag images
merge Pol's nearistNode function