added functionality to the cancel button