* Fix an error where True/False were being written-out
as title-cased strings when used a dictionary keys.
* Speed-up iteration over dicts by looping over items()
rather than keys() followed by value lookups.
* TODO: sort only by keys, not keys and values.