added counter for TSB, nearly finished writing file creation completely