refractor code to finish MDAResolve

Signed-off-by: xiehuc <xiehuc@gmail.com>