Refactor to use localStorage shim
Add localStorage shim