Some incremental progress. Going to check memory leaks in Linux with valgrind