Clean up lib.Base (and change `max` to `lmax`)