minimal memory optimization tweaks
Merge pull request #155 from rphlypo/min_mem_tweaks

Min mem tweaks