Refine code according to the branch core-compaction.