make index as integer in findClosest()