XML creation and some slight fixes