Instrument m/bounty.py and clean up import statements.
Remove duplicated code, add debug instrumentation, add a few tweaks.