Miscellanous code cleaning.
Update test script and utilities to better report failures.