Here is a diagram on how it works.