added a trajectory builder function in macros