adding emd_flow improvements