Return mappings as KVP (struct) and optimize sorting