Added code to find closest point