Moved cancel logic into cancel function.