Nobel-prize winning psychologist Daniel Kahneman has shown that recollection of past experiences is almost entirely determined by two things: 1) how the experience felt when it was at its Peak and 2) how it felt when it ended.
When people evaluate past experience, they only recall two things: how it felt at the peak and whether it got better or worse at the end. As a result, a slight improvement, even an improvement from "intolerable" to "pretty bad," makes the whole experience seem better, and a bad ending makes everything seem worse. This "peak-end" rule is how we summarize the experience and then we rely on that summary to remember how the experience felt.