Made URL generation more efficient