big restructuring of signalhandling