added redundancy check, added support for png, gif