added file insert string, refactored the string write