Fixing Mistakes in code and changed to saving to file