Foreshadowing for the third movie
I was initially pretty disappointed with the second movie because it incorporated way more of the third book than it should've, and incorporated far less of the second book than it should've (no actual "trials," no switching of Teresa and Aris, no actual Group A - Group B shenanigans). And then I watched it a second time and noticed something I hadn't noticed before. When Brenda scanned Thomas with her nifty WCKD-barcode-reader, I looked carefully at what the device said. At the bottom, visible for just two or three seconds, was: "TO BE KILLED BY GROUP B." And then the way the movie ended made more sense — because everyone is being taken back to WICKED, the "trials" from the second book will be put in the third movie (probably tweaked in some way so we don't get put back in the Scorch again). And here I thought they'd completely done away with it all... BUT NO. So that's good. Am now super excited for the third movie... wonder how they'll tackle it.
As a sidenote, I think this movie handled Teresa's betrayal far more deftly than Dasher did. In this movie (and presumably the next), Teresa's betrayal (and Thomas's hatred for her after) make a LOT more sense. I was always so confused/frustrated as to why Thomas couldn't get it through his head that Teresa was basically being forced by WICKED to go through with her "betrayal." In the movie, she has control over her actions and that makes it all the more real/believable.