Please add error handling, so that when a run errors it does not crash but instead returns the last result calculated.