Split signal handler in two for simpler code.