refactor visitor class