refine codes, no functional change