Add function to main

checking/creating workdir/files & template