Some refactoring for storage layer