refactoring, get save to work