refactoring storage to use protocol and record