finalize diagrams