The saveModelData function was incorporated to the main program