Added support for queries