Explaining the solution

I defined steps 4-6.