Breakout source file code to method.

And add on_send_file option to source/execute file.