Fix for incorrectly flattening secondaries.
Some experimental changes.