fixed precalculation, improved thesis