implementing MDF.
f2 term does not seem to work. Should look up the thesis.