deleted input1
renamed old inefficient algo