Added query support; fixes #8