figuring out subtotal