refine the codes of cluster