integrate nex, add more tests