ES6ified version + allowed using custom visitor function.