Added tracing facilities for debugging.