More refactoring
Merge pull request #203 from pcpiela/master

More refactoring of graph.php