Further refactor of map apply logic.