Rebase against jgn-new-ui branch and fix various merge conflicts.
Merge pull request #69 from tmcgilchrist/type_specs

Add type specs.