fix bugs in motion model with trajectories, and with mod arithmetic.
finished! (i think)