case "cancel": updated to function