basic functions working with nw
Tidied up a bit