added C-g to cancel input and corresponding function evaluation