added subtotal function