encoding improvements