Small optimizations
Optimized by precalculating Boltzmann factor