Added test for toDict.  Tigthened up toDict call based on feedback from, um, anonymous GitHub user.