#163 xml loader refactor: functional version, additional refactor to be done though