refine code structure.