Another small optimization to the compute function