Slight refactoring to hide ugliness of extracting a string result from a javascript.
Formatting according to Google Java style guide.