Finished encode function...