Refactor storage code.
Cleanup tests code.