To me, a lot of the code here seems like it might be fairly commonly used in various driver (checking size).

Is there any way to put some of this in a function in the driver that just checks the avatar size to remove some code from some of the drivers?