All of these operations are synchronous, which means the call to `callback()` can simply be made after the loops without a length check.