Refine the code.