refactored URI generation