added tracing logic