How do ATP and ADP function in capturing and releasing energy?

When Inorganic phosphate ions, that usually repel are required to be bonded to form ADP or ATP, a lot of energy has to be given. So the bonds formed have high energy.

ATP Pi-Pi-Pi
When one of these bonds break to form ADP, they release huge amounts of energy.
ADP Pi-Pi + Pi + Energy....

:)