memory.lua: Fixed bugs introduced in editing.
Edited for book clarity, particularly Memory chapter.