refactor cart controller