some re-arranging to add --trace and clean up failure output slightly