used localStorage instead of cookies