Fix history pages

Fix history pages. This is forked from my `ek-setup-staging` branch so please merge that one first (then the diff will be much smaller here)
Indexes are being removed and then added here. Is this to clear them?