add debug statements and missing whitespace