! fixes for the avatar security problem as reported at smf / github 701
! general formatting and cleanup

Signed-off-by: Spuds <spuds@spudsdesign.com>