add function that calculates a total, incorporating ace logic