Changed `map` to `map!` at various places to avoid extra array creation.
Merge pull request #780 from vipulnsward/map_changes

Changed `map` to `map!` at various places to avoid extra array creation.