Avatar manager

Fixed and simplified AvatarManager and its use.