Refactor Mapping.map function.