I agree this is confusing. I'm still trying to figure out the duplicated lines of code... Why not move the check about Location vs. CourseLocator down after you have the groupname to remove duplication?