Don't create objects without a failure.
Use explicit auto-boxing.
Merge pull request #745 from peter-lawrey/master

Minimise object creation without a failure.