Used valgrind to identify memory problems, tests now clean