Refactored storage out to separate script. Added unit tests for tesint it.