Refactoring of graph API