Re-factored to support Google OAuth2