modified code to deal with xml
generate id numbers