Another attempt.  Still too inefficient.