add hack to enable debug mode, and a bunch of comments relating to it