Minor tweaks to memory clean-up.