Query widget

Not quite ready for merge yet. Need to make a few more changes