Here's the code you asked about. This screenshot shows the first half.