switched to query.v1 json interface, some cleanup