Convert main.cpp to NFDinit.cpp and NFDinit.hpp