refactor storage to a separate class