Thinking before sleep