Overall fix: typos and psudocode. (Credit: Keenan)