code for curve tracer