More abstraction in preparation for seperating storage module into a seperate JS package