Added diagnostic debugging code.