almost works. some slight bugs with trajectory calculation and/or termination