Smartened up url shortening