Better localstorage implementation