Made history work with localStorage so that the user's history remains between sessions.