Most of the cleanup

[ci skip]