Added basic support for custom queries