Added 2nd Algorithm