Move mapping mode to its own module and add tests

4 jobs for master in 1 minute and 17 seconds (queued for 2 seconds)