cart logic improvement