#12: Fixed HeapSpaceError and rewrote analyze().