Refine the code structure.