changed query infra for future references