refactor the helper and add one method for cancel action