Refactored even more code in graphs