refactor storage, statehistory and added one command match