refine the diagram