Replaced global localStorage reference with .localStorage