Create a google function

Refactor previous code by using this new defiend google function to
remove duplicate lines of code.