Added Cancel button and implemented logic behind it.