Add model structs and json support.

Also logging.