sets up each loop / nested loop method