Simplify the calculation. Now everything works much better.