Initial work on encoding.