minor cleanup in generateMappingFunction