refactoring cart