refactor for storage