removed tracing code causing slowdown; cleaned up some code