Refactor code for lengthening of short url's in URLShortener utility