added states stack pop for each node stack pop to the reduce action method