Now works for multi output systems.