Performance improvements on the compute_leavs() routine.  There is
opportunity for further improvement in this area.