Lots of proper use of debugprint and mtargs plus some small cleanup.