See http://socghop.appspot.com/gsoc/student_proposal/private/google/gsoc2010/daveb/t127065038275