Added support for Unflattening maps.

With thanks to James World for inspiration.