Added tracing in and out functions