Compile refactor using visitor