I think this function should just be inline in filteredAvatarUrl, primarily so you can get rid of the #define values.