added cancel logic