Refactor url generator.