TV and Film Question about the "Avengers" movie?

The Hulk was completely out of control, tearing up the helicarrier, and chasing the Black Widow. He was fighting Thor as well. Why did he all the sudden grow some brains and fight with them as a team? Banner even seemed to change at will when he first attacked the giant flying alien creature at the beginning of the battle. In the comics there are times Banner controls the Hulk. There are other times the Hulk is semi-intelligent, or very intelligent, without Banner's influence. But this doesn't seem to be the case in the movie. What gives?