refactor. open and save file!