ticket 277: handle different, expected annotation encodings.  plus some code cleanup