Refactor graph