added input output identification algorithm