Adding functionality to the cancel button