Refactoring for graph hash