Define some functions for cleaing up the trace