added intermediate log options
write out intermediate log every 20 iterations