Lots of structural cleanup