simplify types and fix FromJSON