generalized parsing the id