Adapt recent changes and improve where possible.
Adapt recent changes and improve where possible.