Update storage.js

Added encapsulation.