Mapping refactor

Hmm. not sure what happened there, or why I seem to have merged that other PR. Anyway.