Added Query support (closes #377)