New style classes

Fixes #1918. Two commits to make the review easier.

Review please? @danielgtaylor