use c++ features in ngt

also, add a few tests for ngt