added functionality to quit on keypress