Curve function finished!! --wasn't too bad