Add query functionality