cart refactoring