implemented local storage functionality