Simplified closestPoint code