Completed 4a 'encode'