refactor storage and statehistory components