improved code of updateFile method