v0.4.0 final, leaf count errors corrected