local storage logic