Query widget

Not quite ready for merge yet. Need to make a few more changes
logging, or just drop it.