Add a more robust dictionary construction.