refactor visit controller