Refactor visitor graph