Refine utility code.