Massive reconstruction. No real features here, but this makes extending and adding new entities manageable.
Additional cleanup.