Refactor and clean cart