refactor usage of debug notifications

* also some whitespace cleanup