Fixing memory leaks part 2.