Fixed the CMake stuff a bit, put some work into NBVM.