updated to check if cart is empty