Refactoring:

  * better API/impl isolation
  * better typing system, less opaque/TLV thrown at the user face
  * use the new typed nodes for writing
  * JSON API changed for following the new Java API