Fixed outstanding issues, added ToJSON instances.