Replaced window.localStorage with localStorage