Speed improved
code speed-up by reducing file write rates