added extended debugging code