added key handling, escapes quits the program now