Implements auto-calc total function.