Merge remaining changes into typedfields

Merge of some changes that weren't in the typedfields branch.