add arraySort which is sort array that came from nearPoly function