Some refactoring in the graphs