script refine, do not put all control logic to script !