refine code part