refactor,clean code,next step,refactor WriteToFile