Refactor cart work