Added support for both local and session storage.