Output mapping reworked.

Fixes #142