Feature/valgrind
I tested thoroughly with valgrind and fixed every problem that I found. There were various minor memory leaks, possible use of uninitialized data, dangling pointers etc. Functionality should be unchanged, but the application should be more stable as a result of the fixes.
I added a cmake option (NSX_VALGRIND) to force the test suite to run through valgrind (off by default). This will help automate things in the future and detect memory problems in new/modified code as soon as they occur.