Well that answered 2 out of 3 questions...

Can you please explain what the code does exactly?