refactor for stash