Added closest points function