lots of debug code