Reworked loop handling from foreach to for and iterators in Haff::calculate().