Refactoring the js to not need visitor contexts