added some support for TRACE_TS, cleaned up a bunch of things...