Updated xml parse loop