Adding memory cleanup for phylogeny.