NMF code