General cleanup, needs new XMLreader to work