When you're sleeping your brain is switching to repairing mode, it's healing itself so throughout the day if I'm not mistaken something called metabolic waste builds up in your brain which you might call brain cell excretion and when you sleep your cerebrospinal fluid (fluid that flows in and around the hollow spaces of the brain and spinal cord) channels open up and a water rinses through your brain and it clears out all that scrap that builds up during the day. Now if we don't sleep properly, which is 8 hour sleep for an average individual (may vary with age and people) your brain does not clean itself. It turns out for most people with dementia (and rare case manics) it is because their brain is literally clogged up.