comment, add PARAMS, add license info and fix indentation.
for writing debug info to a log file or stdio.