Updated to use avatar template code directly.