If the URL is already a short URL on this domain, don’t re-shorten it, but instead return the existing short URL for it. This is useful in Twitter clients like Tweetbot for iOS that automatically shorten any URL you enter, even if it’s one you’ve shortened before.
… entries have the same date Ref. #6.
Also, some coding style tweaks.