Tidied up Mapping class and computation logic

This was prompted by a bug report, whuch turned out to be not
a bug at all. But the code wasn't all that clear here, so hopefully
better now.
Merge branch 'production'
AOValidator was not attaching failed item results
Minor fixes to items/tests in code-examples mod