Add query support, closes #21