refactored final loop; not sure if i should keep it at all
added comments and removed loopLimit reduction