New encode script.