Finished draft of new traj sim code.