added tracing code