tidied up url shortener example code