modified the code so that the get trajectory code would directly return
the code we wanted