Added XML parsing logic