Getting rid of memory leaks in project 2.