some more debugging code and comments