Use window.localStorage instead of just assuming it's global