Refactoring storage.c