added file write to saveing function