Fixed bug writing .tfs file multiple times.
Pretty print .tfs files if they need to be changed.