Whip into shape

To transform or change something that is failing into something that works effectively.

The coach worked hard to whip the team into shape after a very bad season.