How we sleep in good and bad terms