See hypnopompic and hypnogogic in the introduction