Added a method clickedCancel() for enhanced readability