refactoring some of the gravatar logic