Add support for advanced queries