update to use iter()

Thanks @Jorge-C for suggesting this!