+= time measurement
some optimizations