added functionality for cancel button