Refine the code for PCD tools.