I agree with @Malachi:
unless the question is read carefully it seems like the code doesn't
work, but the OP has said they could only get it to work using the
last bit of code
A question like this may need to have been read carefully in order to determine whether or not it should be closed. I admit that I didn't read it carefully enough, and I apologize for that. Even if it still wasn't clear to me, I should've skipped the vote.
Ideally, I would hope to see an OP use the word "working" to indicate that the code does work. I'm not suggesting this be new policy, though. I'm just used to an OP keeping it clear that his/her code works, which could also be an indication that the FAQ was read prior to posting. But I certainly understand that that cannot be the case each time, so I will be sure to read more carefully in the future.
I just wanted to get that out there. Anyway, I have already voted to reopen.