modify generate_name method