some performance and debugging changes