Overhaul the internal/external key derive switch