Implement Queryer, some other minor speedups.