Refactoring cart class