Adjustments to work better with translation

including switching to an object rather than a dict with varying type
values, being less fancy with iterators and slices, and not overwriting
locals with differing types.