Refactoring openid tools.