Move signal handling stuff from main to dump