modified fdo.cpp