Curve Algorithm

I'm not even sure if this works though...