removes cruft, adds better debugging