Added history functionality for when 404 or other errors occur