added cancelling for while typing