The code works, but I don't know why.