What does a tail on a bird do?

When a planes flies, it uses its wing flaps to stabalize it and keep it going steady. The same thing for a bird. It helps the bird turn and fly straight and keep it from flying around like its drunk.