corrected getClosestItem