'Added saving of output every 500 iterations to prevent loss of work
with long runs.'