started implementing query functionality