refine code structure
change config IO into redirection
format code
change output file spec into redirection
add version detor for json_encode pretty print