Memory leaks fixes. New files added.