refine few codes