Updated debugging code