Refactor graphs