Refactor tests and gravatar helper