Creating a smarter cart and Handling Errors