Added ctrl-c handler to properly reset the terminal