Refine some code.