Examples for #392.
#368, #393, tests and documentation.
#405.