Reducing the number of calculations