Debugged curve.cpp