optimization in viewmap