Improved XmlScript and added unit tests