redirect stdout to .txt and moved customscript to main source file