Fix variables name
Change global variables to local variables
Create a new function: get_id_info