the keys should of course be sorted