Updated nbfi test suite, tests and a bit of refactoring