first implementation for new storage logic
refactored + restructed code