Second pass at error encoding