Extract key/type name map generation to own function