replaced workings of saveModule() with functions from XML package