restructured graph; added legend