re-wrote XML parser