Changing loop results to use branch classes and fixing issues.