TransferObject: Optimize code
WriteInFile: Use buffer