formatting fixed, and also restoring signal handler added