refactor cancela and clear