adding cancel buttons functionality