fixed debug printing bugs and rationalized debugging.