added comments and tests to saving and loading