added gif handling