refactored xml loading and hg data storing