         // TODO - configLayer.displayLevels = displayLevels;
         var imageFormat:String = layerXML.@imageformat[0];
         var isDynamic:Boolean = (configLayer.type == DYNAMIC);
-        configLayer.imageFormat = isDynamic ? parseImageFormat(imageFormat) : imageFormat;
+        configLayer.imageFormat = isDynamic ? toKnownImageFormat(imageFormat) : imageFormat;
         configLayer.token = layerXML.@token;
         configLayer.url = layerXML.@url;
         const useproxy:String = layerXML.@useproxy;

        return configLayer;
    }

    private static function parseImageFormat(imageFormat:String):String
    {
        var parsedImageFormat:String;

        switch (imageFormat)
        {

            case "jpg":
            case "gif":
            {
                knownFormat = imageFormat;
                break;
            }
            default:
            {
                knownFormat = "png8";
            }
        }

        return knownFormat;
    }

    public function encodeXML():XML
