graph nearly working