Refactor married keychains

* move handling of following keychains into the leading keychain
* move multisig threshold into the leading keychain
Added code sample.