added basic support for animated gif
removed assignDir function 1
removed assignDir function 2