Add signal handler to gracefully kill threads.
Fix printing