added animated gif support, fucked around in onpreviewframe for no reason