Forked from http://sw.deri.org/2008/12/alerts/, with permission from Aidan Hogan http://sw.deri.org/~aidanh/