Commented code; added support for xbm and tga.