What if the user provided an empty dictionary? I think this will fail...