refactor split into storage and retrieval