added ctrl-q exit, cleaned up keypress handling