Added query functionality.