working on issue #8, and a few valgrind complaints
working on issue #8, and a few valgrind complaints