Added signal processing (SIGUSR1, SIGINT).