There are other combinations of map and clone in the code, but
this commit only addresses the straightforward ones.

Fixes 367.