refine setup and reformat graph