refactor visitors, add ScopeVisitor