(PDB-708) finish encoding work

Signed-off-by: Ken Barber <ken@bob.sh>