fixed closest points script