in sleep your subconcious mind practices skills such as hand i coordination and activities concentrated daily, it seems while you were asleep your mind found a solution. without this subconcious programming you would probably have a much harder time with difficult tasks on a daily basis, your subconcious mind is always visualizing important tasks for the next day before you do it, this explains why sleeping immediateley after studying can be easier for some.