Add trait/resource type parametes.
Reorganize somewhat.