reorganize script and set algo in parsej