Beetle on bread board

I'm a bit confused as to how to connect it and ground everything. In the adafruit diagram, the 5v goes from the ardunio on to the breadboard connecting to both the diode and the motor.

But if I replace the 5v pin with the AA batteries then the tracks will still burn as the current will be too high.