working on encoding