According to Freud in The Interpretation of Dreams (1900) when we are dreaming the censor which prevents the conscious mind perceiving what is repressed in the unconscious is relaxed. When we wake in the middle of a dream the conscious mind is momentarily aware of the dream thoughts and a process of “secondary revision” then occurs which attempts to recuperate the problematic contents of the unconscious into a plausible story.
As the name “bearbeitung” (re-working) implies, this process is seen as coming after the original “Traumarbeit” (dream-work) which uses the mechanisms of
Clark, Robert. "Secondary Revision". The Literary Encyclopedia. First published 24 October 2005
[http://www.litencyc.com/php/stopics.php?rec=true&UID=1605, accessed 11 December 2016.]