TempMap effect and some optimizations