added custom query support