added mgf.cpp