edited loops in lucy mazzali to not go off end of arrays