Merge mapping implementation from branch.