encoding scripts improvements