eliminated redundancy in writing file