Study looks inside brain during sleep to show how memory is