I don't fully understand what is being achieved here, perhaps add some comments explaining what's going on?