added createQuery and query methods