rewrote curve_smooth_to_q in 2d vector form, and fixed closed curves