removed a for loop and a mutable variable
Removed yet another for loop and a mutable variable7