Adds function flatMapValues.

Hmm - Was this a bug in our earlier flatMap code ? If so, it'll be great to have a unit test for this. (i.e. some test that would have failed before and is fixed by this change)