Reworked XML parsing and loading. commit 2.