A lot more optimization for getting the MF ids.