Adding custom query function support