change unroll to be index-based instead of being iterator-based, adapt the new algorithms to use it