i changed it to this at some point while debugging what i thought might be an issue of the dict getting reinitialized in a recursive call and not propagating back to the caller. not sure if it actually fixed it or whether there was something else that fixed it, but this seems safer anyway