externalizing the computecurvature function