Some attr generator and iterator refactoring.