Move signal handlers to a better place