Refactored loops and found a regression that we won't fix for now