Not really sure what you mean works and what not. I tested the code and got the expected result (google index page).