Moved avatar functions into their own file to improve modularity and readability.