optimize gravatar_helper and tests for flash and errors