Rework automatic content type setting.
Cleanups.