Fix factories and smelting.
Cleanup imports again.