Infrastructure for alerts
Also fixed logout