switch from vec::each to each method