changes to saving, removed an infinite loop.