add action definition and remove some useless logic