generate url method - but to add more code
Generate URL method
Removed dead code