fix various trajectory bugs. code review w/ YH at some point
jindent and import clean up