Switch from readarray to readline loop because of readarray compat issue
Remove unused lines