Changes from zookeeper instrumentation.  Includes debug code and a lot of cruft; future commits will tidy this up