started work on nnf and knd functions