DC21-586: Refactor cart functionality to improve performance