updated index, going to try to update the 'if' from the old loop