Fixed bug in function for loading xml archives
Refactored function.