changed algorithm for url generation