I'd change this method so i takes $sectionLinks as an argument and returns sections. Also you can consider using $sectionLinks.each instead of for