Refactor and more work with alerts (still not getting any).