added toggling on/off with CTRL-D
fixed CTRL-C exit function