Initial work on grouping loops.