Some code from the collective intelligence book. And winter ale.