Updated graph generation to make it neat and easier to understand