Refactor

Complete separation of map and string rewrites into their own classes.
No expected change in function.