huge improvements with the mappings code