Found a memory leak using valgrind, forgot to delete the first node in the list given a special case. It has been fixed now and I will continue testing for more leaks