Added diagram and explanations.