Extensive memory leak reduction. Still missing some.