move pattern method out from
add some debug