Added catch_signal function and also modified for regular files sending