Lots of debug code