fix some const-correctness; reconsider basedb requirements
multithreaded querying