Changing branch iterator to lambda.