Add algo into #3