move out process_signal
added json support