changed layout. iterate printout and graph are done together instead of separately