written by Mark Horton; add Berkeley copyright