refactored generate_shortform method

instead of assigning the id element to the shortform column, we are now
generating a random string and checking it against the database for uniqueness.