Added optimization to map.