small refactor of $save