Much faster (walks through document only once), wrapped in function to prevent polluting global namespace.
Merge remote-tracking branch 'origin/master'