Implement optimization of ofmd