fixes #886

This should be fairly self-explanatory, but I'm happy to answer any questions.
This is really a lot less complicated than it might look at first :)

Deeply-nested chains of dictionaries can be a little intimidating, but they're really a snap once you get the hang of it.