Restructure of closestPoints functionality