Added some exeption handling, and Ctrl-D exit key.