split mappings generator into separate function