First pass at refactoring iteration calculation.