Optimized setUri method