Tony TS2EB merge request #4
New version code supports refinement and multiple outputs, please help me to review this code and give me some modify suggestions. Since this is the first version, maybe many problems exist, I will try to solve them one by one and merge them only after you think it is good enough. :-)