Refactors Writers to reduce code duplication; Adds support for Gif files