Refactor short_url method