Added constraint and tidied up mapping to use it.
Authored by: philsp 2020-05-06
Parent: [r5893]
Child: [r5895]