CLN: refactor visitor methods into a base class
CLN: minor things
ENH: add a query function to supplement eval