optimise calculate