Trace function.