Some debug optimization code

some more efficient debugging code implemented.