Refactored traverseCurve. So clean.