Add query support, closes #12