changed encoding mode key to "type"