Fixed a few cases where free-ed memory blocks were subsequently read. Removed some unused variables, #includes, other small cleanup.
- 755 -> 644