Fix bugs. Make all text files write automatcally.