Add the save and calculate function