Created a function for adding signal handlers. Now also handles Ctrl-C