apply some small optimizations for map