Various cleanup tasks in preparation for opacity support.