Alert works now after restart

- The alert is now triggered after a restart as well
- Some cleanup and minor improvements