refine val script