query-map implementation