start of trace functionality