4 times "elseif" is not the way

and precalc. value sometimes help if well commentent