Replace ad-hoc type coding with wrapped-dict classes