reorg and better control-c handling