adds query functionality