Refactor to avoid deprecation by Google.
Merge pull request #1 from dandersson/fix_deprecation

Refactor code to avoid extension deprecation by Google.