Fixed some units. Added support for polymorphism in the JSON codec.