Refactored avatar preparation.