lift uri extractor out of loop